Optimal. Leaf size=136 \[ \frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) x}{4 a^2}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.21, antiderivative size = 136, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {3639, 3670,
3556, 3607, 8} \begin {gather*} \frac {x \left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right )}{4 a^2}+\frac {(c+i d)^2 (3 d+i c)}{4 a^2 f (1+i \tan (e+f x))}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(-d+i c) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3556
Rule 3607
Rule 3639
Rule 3670
Rubi steps
\begin {align*} \int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx &=\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}-\frac {\int \frac {(c+d \tan (e+f x)) \left (-2 a \left (c^2-2 i c d+d^2\right )+4 i a d^2 \tan (e+f x)\right )}{a+i a \tan (e+f x)} \, dx}{4 a^2}\\ &=\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}+\frac {i \int \frac {-2 a^2 c \left (2 c d+i \left (c^2+d^2\right )\right )-2 a^2 d \left (i c^2+4 c d+3 i d^2\right ) \tan (e+f x)}{a+i a \tan (e+f x)} \, dx}{4 a^3}-\frac {d^3 \int \tan (e+f x) \, dx}{a^2}\\ &=\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}+\frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) \int 1 \, dx}{4 a^2}\\ &=\frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) x}{4 a^2}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(305\) vs. \(2(136)=272\).
time = 2.03, size = 305, normalized size = 2.24 \begin {gather*} -\frac {\sec ^2(e+f x) \left (4 i c^3+12 i c d^2-8 d^3+\cos (2 (e+f x)) \left (3 c^2 d (-1-4 i f x)+d^3 (1+4 i f x)+c^3 (i+4 f x)-3 c d^2 (i+4 f x)+8 d^3 \log \left (\cos ^2(e+f x)\right )\right )+c^3 \sin (2 (e+f x))+3 i c^2 d \sin (2 (e+f x))-3 c d^2 \sin (2 (e+f x))-i d^3 \sin (2 (e+f x))+4 i c^3 f x \sin (2 (e+f x))+12 c^2 d f x \sin (2 (e+f x))-12 i c d^2 f x \sin (2 (e+f x))-4 d^3 f x \sin (2 (e+f x))+8 i d^3 \log \left (\cos ^2(e+f x)\right ) \sin (2 (e+f x))+16 d^3 \text {ArcTan}(\tan (f x)) (-i \cos (2 (e+f x))+\sin (2 (e+f x)))\right )}{16 a^2 f (-i+\tan (e+f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.24, size = 159, normalized size = 1.17
method | result | size |
derivativedivides | \(\frac {\left (-\frac {1}{8} i c^{3}+\frac {3}{8} i c \,d^{2}-\frac {3}{8} c^{2} d -\frac {7}{8} d^{3}\right ) \ln \left (\tan \left (f x +e \right )-i\right )-\frac {-\frac {3}{2} c^{2} d +\frac {1}{2} d^{3}+\frac {1}{2} i c^{3}-\frac {3}{2} i c \,d^{2}}{2 \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {\frac {3}{4} i c^{2} d -\frac {5}{4} i d^{3}-\frac {1}{4} c^{3}-\frac {9}{4} c \,d^{2}}{\tan \left (f x +e \right )-i}-\frac {i \left (3 i c^{2} d -i d^{3}-c^{3}+3 c \,d^{2}\right ) \ln \left (\tan \left (f x +e \right )+i\right )}{8}}{f \,a^{2}}\) | \(159\) |
default | \(\frac {\left (-\frac {1}{8} i c^{3}+\frac {3}{8} i c \,d^{2}-\frac {3}{8} c^{2} d -\frac {7}{8} d^{3}\right ) \ln \left (\tan \left (f x +e \right )-i\right )-\frac {-\frac {3}{2} c^{2} d +\frac {1}{2} d^{3}+\frac {1}{2} i c^{3}-\frac {3}{2} i c \,d^{2}}{2 \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {\frac {3}{4} i c^{2} d -\frac {5}{4} i d^{3}-\frac {1}{4} c^{3}-\frac {9}{4} c \,d^{2}}{\tan \left (f x +e \right )-i}-\frac {i \left (3 i c^{2} d -i d^{3}-c^{3}+3 c \,d^{2}\right ) \ln \left (\tan \left (f x +e \right )+i\right )}{8}}{f \,a^{2}}\) | \(159\) |
risch | \(-\frac {3 i x \,c^{2} d}{4 a^{2}}-\frac {7 i x \,d^{3}}{4 a^{2}}+\frac {c^{3} x}{4 a^{2}}-\frac {3 x c \,d^{2}}{4 a^{2}}-\frac {{\mathrm e}^{-2 i \left (f x +e \right )} d^{3}}{2 a^{2} f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} c^{3}}{4 a^{2} f}+\frac {3 i {\mathrm e}^{-2 i \left (f x +e \right )} c \,d^{2}}{4 a^{2} f}-\frac {3 \,{\mathrm e}^{-4 i \left (f x +e \right )} c^{2} d}{16 a^{2} f}+\frac {{\mathrm e}^{-4 i \left (f x +e \right )} d^{3}}{16 a^{2} f}+\frac {i {\mathrm e}^{-4 i \left (f x +e \right )} c^{3}}{16 a^{2} f}-\frac {3 i {\mathrm e}^{-4 i \left (f x +e \right )} c \,d^{2}}{16 a^{2} f}-\frac {2 i d^{3} e}{a^{2} f}+\frac {d^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{a^{2} f}\) | \(224\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.04, size = 131, normalized size = 0.96 \begin {gather*} \frac {{\left (16 \, d^{3} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 4 \, {\left (c^{3} - 3 i \, c^{2} d - 3 \, c d^{2} - 7 i \, d^{3}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{3} - 3 \, c^{2} d - 3 i \, c d^{2} + d^{3} - 4 \, {\left (-i \, c^{3} - 3 i \, c d^{2} + 2 \, d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{16 \, a^{2} f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.49, size = 393, normalized size = 2.89 \begin {gather*} \begin {cases} \frac {\left (\left (16 i a^{2} c^{3} f e^{4 i e} + 48 i a^{2} c d^{2} f e^{4 i e} - 32 a^{2} d^{3} f e^{4 i e}\right ) e^{- 2 i f x} + \left (4 i a^{2} c^{3} f e^{2 i e} - 12 a^{2} c^{2} d f e^{2 i e} - 12 i a^{2} c d^{2} f e^{2 i e} + 4 a^{2} d^{3} f e^{2 i e}\right ) e^{- 4 i f x}\right ) e^{- 6 i e}}{64 a^{4} f^{2}} & \text {for}\: a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {c^{3} - 3 i c^{2} d - 3 c d^{2} - 7 i d^{3}}{4 a^{2}} + \frac {\left (c^{3} e^{4 i e} + 2 c^{3} e^{2 i e} + c^{3} - 3 i c^{2} d e^{4 i e} + 3 i c^{2} d - 3 c d^{2} e^{4 i e} + 6 c d^{2} e^{2 i e} - 3 c d^{2} - 7 i d^{3} e^{4 i e} + 4 i d^{3} e^{2 i e} - i d^{3}\right ) e^{- 4 i e}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {d^{3} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a^{2} f} + \frac {x \left (c^{3} - 3 i c^{2} d - 3 c d^{2} - 7 i d^{3}\right )}{4 a^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.82, size = 226, normalized size = 1.66 \begin {gather*} -\frac {\frac {2 \, {\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{a^{2}} + \frac {2 \, {\left (i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} + 7 \, d^{3}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a^{2}} + \frac {-3 i \, c^{3} \tan \left (f x + e\right )^{2} - 9 \, c^{2} d \tan \left (f x + e\right )^{2} + 9 i \, c d^{2} \tan \left (f x + e\right )^{2} - 21 \, d^{3} \tan \left (f x + e\right )^{2} - 10 \, c^{3} \tan \left (f x + e\right ) + 30 i \, c^{2} d \tan \left (f x + e\right ) - 18 \, c d^{2} \tan \left (f x + e\right ) + 22 i \, d^{3} \tan \left (f x + e\right ) + 11 i \, c^{3} + 9 \, c^{2} d + 15 i \, c d^{2} + 5 \, d^{3}}{a^{2} {\left (\tan \left (f x + e\right ) - i\right )}^{2}}}{16 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.66, size = 184, normalized size = 1.35 \begin {gather*} \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {3\,c^2\,d}{4\,a^2}-\frac {5\,d^3}{4\,a^2}+\frac {c^3\,1{}\mathrm {i}}{4\,a^2}+\frac {c\,d^2\,9{}\mathrm {i}}{4\,a^2}\right )+\frac {c^3}{2\,a^2}+\frac {3\,c\,d^2}{2\,a^2}+\frac {d^3\,1{}\mathrm {i}}{a^2}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (-c^3\,1{}\mathrm {i}-3\,c^2\,d+c\,d^2\,3{}\mathrm {i}+d^3\right )}{8\,a^2\,f}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (c^3\,1{}\mathrm {i}+3\,c^2\,d-c\,d^2\,3{}\mathrm {i}+7\,d^3\right )}{8\,a^2\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________